﻿/***************************************************************************
//* Foxit Software Inc.
//* Copyright(C) 2005-2012, all rights reserved.
//*
//* The following code is copyrighted and contains proprietary information
//* and trade secrets of Foxit Software Inc.                                                      *
***************************************************************************/
/**
* PDF Destination
*/
define(function (require, exports, module) {
    require('../DataLevel.js');
    FXREADER.PDFData.DestInfoJsonFormat = {
        left: "l",
        top: "t",
        width: "w",
        height: "h",
        pageIndex: "p",
        zoomToMode: "zm",
        scale: "s",
        bPdfCord: "bp",
        bLink: "bl",
        offsetX: "x",
        offsetY: "y"
    }

    var DestInfoFormat = FXREADER.PDFData.DestInfoJsonFormat;
    FXREADER.PDFData.CPDF_DestInfo = function (jsonData) {
        this.left = -1;         //[由Dest指定的左边起始位置]
        this.top = -1;          //[由Dest指定的右边起始位置]
        this.width = -1;        //[由Dest指定的宽度]
        this.height = -1;       //[由Dest指定的高度]
        this.iPage = 0;        //[由Dest指定的页数]
        this.nZoomToMode = 0;  //[由Dest指定的缩放模式]
        this.dbScale = 1.0;      //[由Dest指定的缩放比例]
        this.bPdfCord = true;     //[是否为PDF坐标]
        this.bLink = true;        //[是否是一个Link]
        this.offset_x = 0;
        this.offset_y = 0;


        this.parseDestJson = function (jsonData_Dest) {
            this.left = jsonData_Dest[DestInfoFormat.left];
            this.top = jsonData_Dest[DestInfoFormat.top];
            this.width = jsonData_Dest[DestInfoFormat.width];
            this.height = jsonData_Dest[DestInfoFormat.height];
            this.iPage = jsonData_Dest[DestInfoFormat.pageIndex];
            this.nZoomToMode = 0; // jsonData_Dest.zm; //RD_ZMODE_NULL  先设为0 用于测试
            this.dbScale = jsonData_Dest[DestInfoFormat.scale];
            this.bPdfCord = jsonData_Dest[DestInfoFormat.bPdfCord] == 1 ? true : false;
            this.bLink = jsonData_Dest[DestInfoFormat.bLink] == 1 ? true : false;
        }

        this.parseDestJson(jsonData);

    }

    return FXREADER.PDFData.CPDF_DestInfo;
});